import { DataControl, DataControlEvent } from "./VirtualDataControl";
import { VirtualItem } from "./VirtualItem";

export * from './VirtualItem';
export * from './VirtualDataControl';


const { ccclass, property, disallowMultiple, menu } = cc._decorator;


//--------------------------------------------------------------------



/** 布局类型 */
export enum LayoutType {

    /** 横向 */
    HORIZONTAL = 0,
    /** 纵向 */
    VERTICAL,
    /** 表格 */
    GRID,

};


const CCLayoutType = cc.Enum(LayoutType);



//--------------------------------------------------------------------



/** 矩形接口 */
interface IRect {
    x: number, y: number, width: number, height: number,
}




//--------------------------------------------------------------------




@ccclass @disallowMultiple @menu('虚拟列表/VirtualList')


/** 虚拟列表 */
export class VirtualList extends cc.Component {


    /** 滚动视图组件 */
    @property(cc.ScrollView)
    scrollView: cc.ScrollView = null;

    /** 典型节点 */
    @property(VirtualItem)
    referItem: VirtualItem = null;

    /** 布局类型 */
    @property({ type: CCLayoutType })
    layoutType: LayoutType = LayoutType.HORIZONTAL;



    //--------------------------------------------------------------------



    




    private _dataControl: DataControl;

    /** 数据控制器 */
    public set dataControl(val: DataControl) {
        if (this._dataControl == val) return;
        this._dataControl = val;
    }

    public get dataControl() {
        return this._dataControl;
    }




    /** 测量总尺寸 */
    private measureTotalSize(): IRect {
        return;
    }




}